home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / duplock.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  117 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: duplock.c,v 1.4 1996/08/13 13:52:54 digulla Exp $
  4.     $Log: duplock.c,v $
  5.     Revision 1.4  1996/08/13 13:52:54  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.3  1996/08/12 14:20:37  digulla
  10.     Added aliases
  11.  
  12.     Revision 1.2  1996/08/01 17:40:49  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <clib/exec_protos.h>
  19. #include "dos_intern.h"
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <clib/dos_protos.h>
  25.  
  26.     __AROS_LH1(BPTR, DupLock,
  27.  
  28. /*  SYNOPSIS */
  29.     __AROS_LHA(BPTR, lock, D1),
  30.  
  31. /*  LOCATION */
  32.     struct DosLibrary *, DOSBase, 16, Dos)
  33.  
  34. /*  FUNCTION
  35.     Clone a lock on a file or directory. This will only work on shared
  36.     locks.
  37.  
  38.     INPUTS
  39.     lock - Old lock.
  40.  
  41.     RESULT
  42.     The new lock or 0 in case of an error. IoErr() will give additional
  43.     information in that case.
  44.  
  45.     NOTES
  46.     This function is identical to DupLockFromFH().
  47.  
  48.     EXAMPLE
  49.  
  50.     BUGS
  51.  
  52.     SEE ALSO
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.     29-10-95    digulla automatically created from
  58.                 dos_lib.fd and clib/dos_protos.h
  59.  
  60. *****************************************************************************/
  61.  
  62. /*****************************************************************************
  63.  
  64.     NAME
  65.     #include <clib/dos_protos.h>
  66.  
  67.     __AROS_LH1(BPTR, DupLockFromFH,
  68.  
  69.     SYNOPSIS
  70.     __AROS_LHA(BPTR, fh, D1),
  71.  
  72.     LOCATION
  73.     struct DosLibrary *, DOSBase, 62, Dos)
  74.  
  75.     FUNCTION
  76.     Try to get a lock on the object selected by the filehandle.
  77.  
  78.     INPUTS
  79.     fh - filehandle.
  80.  
  81.     RESULT
  82.     The new lock or 0 in case of an error. IoErr() will give additional
  83.     information in that case.
  84.  
  85.     NOTES
  86.     This function is identical to DupLock().
  87.  
  88.     EXAMPLE
  89.  
  90.     BUGS
  91.  
  92.     SEE ALSO
  93.  
  94.     INTERNALS
  95.  
  96.     HISTORY
  97.     29-10-95    digulla automatically created from
  98.                 dos_lib.fd and clib/dos_protos.h
  99.  
  100. *****************************************************************************/
  101. /*AROS alias DupLockFromFH DupLock */
  102. {
  103.     __AROS_FUNC_INIT
  104.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  105.  
  106.     BPTR old, new;
  107.     struct Process *me=(struct Process *)FindTask(NULL);
  108.  
  109.     /* Use Lock() to clone the handle. cd to it first. */
  110.     old=me->pr_CurrentDir;
  111.     me->pr_CurrentDir=lock;
  112.     new=Lock("",SHARED_LOCK);
  113.     me->pr_CurrentDir=old;
  114.     return new;
  115.     __AROS_FUNC_EXIT
  116. } /* DupLock */
  117.